<?php
$q=$_GET["q"];
$q1=$_GET["q1"];

	include "Global.php";
	//Conexion a mysql y a la base de datos
	$connection = DBConnect();

echo "<table width='250' border='0'>";
if($q=='all'){
	if($q1!='null'){
		$query="SELECT idplaces, name FROM places where idplaces!=$q1"; 
	}else{
		$query="SELECT idplaces, name FROM places"; 
	}
		$resultado = mysql_query($query) or die ('\n error en query ' . mysql_error());
		while($row = mysql_fetch_assoc($resultado)){
				$id=$row['idplaces'];
				$name=$row['name'];
				echo "<tr><td>$name</td><td><input type='checkbox' name='$id' value='$id'/></td></tr>";
	}
}else{
	if($q1!='null'){
		$query="SELECT idplaces, name FROM places WHERE type ='$q' and idplaces!=$q1"; 
	}else{
		$query="SELECT idplaces, name FROM places WHERE type ='$q'"; 
	}
	$resultado = mysql_query($query) or die ('\n error en query ' . mysql_error());
	while($row = mysql_fetch_assoc($resultado)){
			$id=$row['idplaces'];
			$name=$row['name'];
			echo "<tr><td>$name</td><td><input type='checkbox' name='$id' value='$id'/></td></tr>";
	}
}

echo "</table>";

	DBCLose($connection);
?>
